<template>
    <div class="toolbar" style="display: flex;line-height: 55px">
      <div style="flex: 1;text-align: center;font-size: 25px;color: #259cea">
        <span>欢迎来到用户管理界面</span>
      </div>
      <span>{{username}}</span><i class="el-icon-setting" style="margin-left: 5px"></i>
      <el-dropdown>
        <el-icon style="margin-right: 8px; "><ArrowDown/></el-icon>
        <template #dropdown>
          <el-dropdown-menu>
            <el-dropdown-item @click.native="logout">退出登录</el-dropdown-item>
          </el-dropdown-menu>
        </template>
      </el-dropdown>

    </div>
</template>

<script>
import router from "@/router"
  export default {
    name: "Header",
    data(){
      return {
        username:this.$cookies.get('value').userName
      }
    },
    methods:{
      logout() {
        console.log(this.$cookies.get('value'))
        router.push('/')
      }
    }
  }
</script>

<style scoped>
.layout-container-demo .el-header {
  position: relative;
  background-color: var(--el-color-primary-light-7);
  color: var(--el-text-color-primary);
}
.layout-container-demo .el-aside {
  color: var(--el-text-color-primary);
  background: var(--el-color-primary-light-8);
}
.layout-container-demo .el-menu {
  border-right: none;
}
.layout-container-demo .el-main {
  padding: 0;
}
.layout-container-demo .toolbar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  right: 20px;
}
</style>
